home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-10-26 | 7.5 KB | 240 lines | [TEXT/ScoM] |
- PROGRAMMING ROBOT COMPILER
-
- ;; ROBOT COMPILER
- ;; This lets SCOM compile in the background while working with
- ;; other applications. You can determine the number of songs you want,
- ;; and if you like some of the random pieces you can restore it by
- ;; using its random name. Any score can be robotized but you need to
- ;; understand the basics, which are explained here.
-
- ;; Place the robot score in its own folder before you run it. The midi
- ;; files are saved in this directory. You can change this behaviour
- ;; customizing make-song-name. When compilation has finished select
- ;; the midi files in finder and double-click to open them in SCOM for
- ;; playing.
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; extensions needed by the robot compiler
-
- ; this enables to save a midi file to a directory path supplied
-
- (defmacro play-file-f (songname &rest ll)
- `(eval (append '(play-file-nocheck) (list ,songname) ',ll)))
-
- ; this makes a song name based on the file name of the window (and its path)
- ; it returns a directory path string
- ;
- ; (make-song-name)
- ; --> Programming:Symbolic Composer 4.0:Master 0.1:Song 0.1
-
- (defun make-song-name ()
- (let* ((directory (mac-directory-namestring
- (window-filename
- (get-current-compile-window))))
- (folder-name nil))
- (str-cat directory
- "Master " (princ-to-string *robot-master-seed*)
- ":Song " (princ-to-string *robot-song-seed*))))
-
- ; this runs the robot score
- ; each time the score is run, it uses a new random seed
- ; the song is saved on a file determined by the random seed value
- ; all songs are saved on directory determined by the master random seed
-
- (defun run-robot-score (seed nbr-of-songs)
- ; set seed to global *robot-master-seed* so that make-song-name can find it
- (setq *robot-master-seed* seed)
- ; make as many random seeds as there are songs
- (setq random-seeds (generate-n-random-seeds seed nbr-of-songs))
- ; run the score nbr-of-songs times
- (dotimes (i nbr-of-songs)
- ; get first random seed in the list and store it to a global
- ; so that make-song-name can find it
- (setq *robot-song-seed* (pop random-seeds))
- ; initialize random seed
- (init-rnd *robot-song-seed*)
- ; and run the score
- (eval `(progn ,@score-program))))
-
- ; customize run-robot-score when you need more parameters to
- ; control score behaviour, setq parameters to globals
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-
- #| boom-says-the-bass box
-
- Before making a robot that creates 100 new pieces in an hour you
- need to understand the basics. Here is a simple groove box score.
- Run the score and keep changing the init-rnd seed. Each time you
- get a new combination based on element definitions.
-
- Some notes:
-
- With current symbols snare perc and hihat might not be in your setup
- what the names say. define drummap or use def-drumset.
-
- What you put in that will come out.
- Change element definitions. Replace them with generators.
- What does the timesheet do? Double-click def-section-timesheet.
- When you understand how this score is put together you can add as much
- instruments as you want. Extend the timesheet.
-
- Try randomizing the timesheet and rhythms with pulse-string. See
- the docs and you'll immediately see the possibilities. Use mix-strings
- to combine multiple pulse-string outputs.
-
- Bass is fixed. Try changing it.
- If you work on dancable styles keep patterns 1, 2 and max 4 bars.
- Implement intelligent variation mechanisms.
-
- If you are working on zones you are already on the level that you
- can handle randomization on your own.
-
- If you make enhancements to this example it is highly appreciated that
- you post it back to the list.
-
- |#
-
- ;;;;;; to make a score robot-runnable setq it to a variable in a
- ;;;;;; quoted list, see below
- ;
- ; don't use init-rnd since it is set up outside
- ; include (null-compiler) to make each compile fresh
- ; otherwise the score can be any SCOM and Lisp, if you want to
- ; control more of its behaviour set up global variables in run-robot-score
- ; and test the variables inside the score, this way you can make the
- ; score use THIS tonality or THAT depending on the variable, or
- ; do other enhancements.
-
- (setq score-program '(
-
- (null-compiler)
-
- (def-orchestra 'orchestra
- all-instruments (drums instruments)
- instruments (bass sequence)
- drums (kick snare hihat perc)
- )
-
- ; element definitions
-
- (setq kicks '(
- ; 1---!---!---!---2---!---!---!---3---!---!---!---4---!---!---!---
- "- - - - - - - - "
- "- - - - - - - - - "
- "- - - - - - - - - - - - - - - - - "
- "- - - - - - - ---"
- ))
-
- (setq snares '(
- ; 1---!---!---!---2---!---!---!---3---!---!---!---4---!---!---!---
- " - - - - - - - - "
- " - - - - - - - - - - - - - - - - "
- " - - - - - - - -- "
- " - - - - "
- ))
-
- (setq hihats '(
- ; 1---!---!---!---2---!---!---!---3---!---!---!---4---!---!---!---
- "------- - -- ------------ -- ---"
- "---- ------- ------- -------- - "
- " - - - - - - - - "
- " - - - - - - - - - - - - - - - "
- "----------------"
- ))
-
- (setq velocities '(
- (90 100 110 120)
- (120 100 110 100)
- (100 120 80 110)
- (127 90)
- (120 100 80)
- ))
-
- (setq symbols '(
- (a b a c)
- (a b c -b)
- (a d c b)
- (a a -b a)
- (a b -b a)
- ))
-
- (setq rhythms '(
- ; 1---!---!---!---2---!---!---!---3---!---!---!---4---!---!---!---
- "- - --- - "
- " -- - - - "
- " - - - -----"
- " -- -- "
- ))
-
-
- (def-section-timesheet sect-a
- ;
- ; timesheet = bars that the instruments play
- ;
- with 1/1
- tonality drums
- ; 1 9 17 etc bars
- ; !---!---!---!---!---!---!---!---!
- kick "--------------- ------- -- "
- hihat " --------------------- -- "
- perc " ---------------------- "
- snare " ----------------- -- "
- ;
- ; instruments
- ;
- tonality (activate-tonality (hirajoshi c 3))
- ; 1 9 17 etc bars
- ; !---!---!---!---!---!---!---!---!
- bass " ------------"
- sequence " ----------------"
- ;
- ; drums
- ;
- beat 1/16 ; !---!---!---!---!
- kick (pick-random kicks) '(b) with '(127)
- snare (pick-random snares) (list (pick-random '(c d e f))) with (pick-random velocities)
- perc (pick-random hihats) (list (pick-random '(p q r s t))) with (pick-random velocities)
- hihat (pick-random hihats) (list (pick-random '(j k l m n))) with (pick-random velocities)
- ;
- ; instruments
- ;
- beat 1/16 ; !---!---!---!---!
- legato (fix 1/32)
- sequence (pick-random rhythms) (pick-random symbols) with (pick-random velocities)
-
- )
-
- (def-section sect-a
- drums
- channel 10
- bass
- channel 2
- symbol '(a)
- length '(-1/8 1/8)
- velocity '(127)
- sequence
- channel 1
- )
-
- (midiport :printer)
-
- (def-tempo 140)
-
- (play-file-f (make-song-name)
- all-instruments '(sect-a)
- )
-
- )) ; end of setq
-
- ; you can now run the score, supply master seed and number of songs
-
- (run-robot-score 0.123 10)
-
- ; You'll now have a subfolder Master 0.123 in the score root folder.
- ; This folder contains number of songs like Song 0.938362263811738.
- ; The number is a seed, when you want to restore the score you can
- ; supply the number manually to init-rnd. This feature is handy if
- ; you like a score and want to work more on that.
-